package com.demo.java.concurrent.atomic;

import org.junit.Test;

import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicStampedReference;

public class AtomicTest {

    @Test
    public void atomicStringTest() {
        AtomicReference<String> atomicReference = new AtomicReference<>();
        AtomicStampedReference atomicStampedReference = new AtomicStampedReference(new Object(), 0);

        atomicReference.set("RUNNING");

        System.out.println(atomicReference.get());
        System.out.println(atomicReference.compareAndSet(atomicReference.get(), "PAUSE"));
        System.out.println(atomicReference.compareAndSet("PASE", "PASE"));
    }
}
